package com.wwtech.epp.ui.activity.main.module;

import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.main.MyFragment;
import com.wwtech.epp.ui.activity.main.contract.MyContract;
import com.wwtech.epp.ui.activity.main.presenter.MyPresenter;
import com.wwtech.epp.ui.adapter.work.WorkStateAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.main
 * @Description: The moduele of MyFragment, provide field for MyFragment
 * @date 2017/08/21 11:14:48
 */
@Module
public class MyModule {
    private final MyContract.View mView;


    public MyModule(MyContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public MyPresenter provideMyPresenter(HttpAPIWrapper httpAPIWrapper, MyFragment mFragment) {
        return new MyPresenter(httpAPIWrapper, mView, mFragment);
    }

    @Provides
    @ActivityScope
    public MyFragment provideMyFragment() {
        return (MyFragment) mView;
    }

    @Provides
    @ActivityScope
    public WorkStateAdapter provideWorkStateAdapter() {
        return new WorkStateAdapter(new ArrayList<>());
    }
}